<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>物品展示--用户登录</title>

<%@ include file="common.jsp"%>

<script type="text/javascript">
$(function(){
	$("#login_btn").click(loginBtn);
	
});
function loginBtn(){
	var name = $("#username").val();
	var password = $("#password").val();
	if(name==null || name==""){
		alert("用户名为空无法登录");
		return false;
	}
	if(password==null || password==""){
		alert("密码为空无法登录");
		return false;
	}
	$.ajax({
		url:"<%=request.getContextPath()%>/user/getUser",
		type:"post",
		dataType:"json",
		data:{
			name:name,
			password:password
		},
		success:function(data){
			if(data.status==0){
				alert(data.message);
				return false;
			}
			window.location.href = "<%=request.getContextPath()%>/goods/homepage";
		},error:function(){
			alert("系统异常");
		}
	});
}

</script>
</head>
<body class="loginbg">

<h1>物品展示平台</h1>

<div class="login" style="margin-top:50px;">   
    <div class="header"><span>登录入口</span>
    </div>
    <div class="web_qr_login" id="web_qr_login" style="display: block; height: 235px;">    
        <!--登录-->
        <div class="web_login" id="web_login">     
            <div class="login-box">
				<div class="login_form">
	                <div class="uinArea">
		                <label class="input-tips" for="u">帐号：</label>
		                <div class="inputOuter"><input type="text" id="username" class="inputstyle" placeholder="请输入登录账号或手机号"/></div>
	                </div>
	                <div class="pwdArea">
	                	<label class="input-tips">密码：</label> 
	                    <div class="inputOuter"><input type="password" id="password" class="inputstyle" placeholder="请输入密码"/></div>
	                </div>
	                <div style="padding-left:50px;margin-top:20px;"><input type="submit" value="登 录" style="width:180px;" id="login_btn" class="button_blue"/>
	                </div>
	            </div>
            </div>          
        </div>
        <!--登录end-->
  </div>
</div>
</body>
</html>
